home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr52 / clptick.zip / TICKER.DOC < prev    next >
Text File  |  1993-04-07  |  4KB  |  76 lines

  1.  
  2.  
  3.     I have, on occasion, wondered how you would attach a    Clipper function
  4. to the system clock for periodic evaluation ( Usually when I had an urgent
  5. need to do so). With the aid of a few books ( namely Undoccumented DOS and
  6. the DOS Programmer's Reference) and a friend of mine for help with the
  7. Assembly routines an attempt was made, the results of which is in your hands.
  8. I should point out that this routine was written by me in attempt to get
  9. C interrupt acquainted and that there are other routines out there that
  10. will work for you with a lot less hassel -- namely NetLib's N_SETTIME().
  11.  
  12. Many thanks go to John MacDonald, who identified and help to resolve a
  13. rather nasty bug in the original version which led to system hangs and
  14. stack errors.  The solution was to check the dos safe flag before calling
  15. the user defined routine ( a nasty oversight on my part).  This seems to
  16. resolve the problem.  The odd thing about this is that I figured that
  17. I would simply pass the status of the dos safe flag to the clipper udf
  18. and leave it up to the udf to be responsible and not call a dos function
  19. ( Thereby permitting the udf to perform non dos functions uninhibited).
  20. This didn't work -- If the dos safe flag was False the system hangs AFTER
  21. the clipper routine is called and BEFORE it arrives ( I call the function
  22. but it never gets    there EVEN if the clipper udf did not call a dos routine).
  23. I wonder if clipper background garbage collection may have something
  24. to do with this. Not being able to resolve this issue adequately, I simply
  25. programmed the timer routine to not call the clipper udf when the dos safe
  26. flag is false, but to call it as soon as it becomes available. The downshot
  27. of this approach is that if you use ticker() to display a clock
  28. (for instance) and your main program issues a COPY TO, or similar dos,
  29. command -- your clock routine will not display when dos is active
  30. (while the copy to is copying). If ANYONE knows why this happens, or has a
  31. better approach than using the dos safe flag, PLEASE let me know.
  32.  
  33. In order to use this routine you should set STACKS=0,0 in your config.sys
  34.  
  35. IT is EXTREMELY important that you remember to shutdown the ticker()
  36. routine BEFORE you terminate your application.  If you don't you are
  37. guaranteed to force yourself into a re-boot situation.  You might want 
  38. to put a    ticker(0) call in your error handler so that if you encounter
  39. any fatal runtime errors in your application while you are developing it
  40. you won't have to continualy re-boot your system.
  41.  
  42. You should have three programs -- ticker.prg, tickerc.c, and msasm.asm.
  43. and the object modules tickerc.obj and msasm.obj.
  44.  
  45. Ticker.prg:
  46.     This is the clipper5 module which provides your interface to the
  47.     system timer.  It includes a simple test routine which you can exclude
  48.     from compilation by removing the #define _TEST from the source.
  49.  
  50. Tickerc.c:
  51.     C routines which modify the int 8 timer vector and handle the periodic
  52.     servicing of your specified clipper function.
  53.  
  54. MsAsm.asm:
  55.     Assembler replacements for the microsoft _dos_setvector(),
  56.     _dos_getvector(), and _enable() routines, so we don't need LLIBCA
  57.     to link.  The new routines are called _setvector(), _getvector(), and
  58.     _intenable().
  59.  
  60.  
  61. If you have any comments, questions, or encounter any bugs please
  62. contact me -- I am interested in hearing what you think.  These functions
  63. have not been extensevly tested -- they have worked for me without error.
  64. When I have found errors, I have fixed them -- If you find any please let
  65. me know so I can make the required changes.
  66.  
  67.             Brenton Farmer
  68.             CIS: 71621,627
  69.  
  70. If anyone wishes to use these routines permission is granted for use in 
  71. any finished program, commercial or otherwise. However, permission is not 
  72. granted to include these routines in third party commercial or shareware 
  73. LIBRARIES.
  74.  
  75.  
  76.